import plugin from '../../lib/plugins/plugin.js'
import fetch from "node-fetch"
import { segment } from "oicq";
let jiehun=0
let xinren =[]
let targetQQ = ''
export class example extends plugin {
  constructor () {
    super({
      /** 功能名称 */
      name: 'DJ表情插件',
      /** 功能描述 */
      dsc: '表情制作',

      event: 'message',
      /** 优先级，数字越小等级越高 */
      priority: 5000,
      rule: [
        


        {
          /** 命令正则匹配 */
          reg: '^#结婚$',
          /** 执行方法 */
          fnc: 'ol'
        },
        {
          /** 命令正则匹配 */
          reg: '#(.*)$',
          /** 执行方法 */
          fnc: 'xinren'
        },
        {
          /** 命令正则匹配 */
          reg: '^不结了$',
          /** 执行方法 */
          fnc: 'bujiele'
        },

      ]
    })
  }

  async ol (e){ 
                        await this.reply('请用“#@”艾特出新郎')

      }
  async xinren (e){ if (e.message[1].type == 'at'&jiehun == 0 & String(xinren.length)<1){
     targetQQ = e.at;
    xinren[xinren.length] = e.at;
    jiehun = 1
    await this.reply('请用“#@”艾特出新娘')
   }else if(e.message[1].type == 'at'& jiehun == 1 & String(xinren.length)==1){
    let targetQQ2 = e.at;
    xinren[xinren.length] = e.at;
   
        let url ='https://api.caonm.net/api/jhzz/j.php?qq='+ targetQQ +'&qq2='+targetQQ2;console.log(url)
        await this.reply('佳偶双双已天成，金玉良缘喜结盟。夫妻对拜情意浓，不负青春与苍穹。红梅傲雪添喜庆，更添忠贞一生情。雕梁画栋玉屏风，良辰美景到天明。祝：钟爱一生。')
        await this.reply(segment.image(url),true)
        xinren = []
        jiehun = 0
      }

}
async bujiele (e){ if(e.msg == '不结了')
  await this.reply('可惜不是你~陪我到最后~🎶')
  xinren = []
  jiehun = 0
}
}
    